[#ftl]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>[#assign module]suit/${item.scope.id}/renders[/#assign][#assign moduleName="渲染器"]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加新${moduleName}</title>
<script type="text/javascript" src="${base}/commonjs/jquery1.7.2/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="${base}/commonjs/jquery-forms.js"></script>
<script type="text/javascript" src="${base}/commonjs/jquery.select.js"></script>
<script type="text/javascript" src="${base}/commonjs/artDialog4/artDialog.source.js?skin=blue"></script>
<script type="text/javascript" src="${base}/commonjs/artDialog4/plugins/iframeTools.source.js"></script>
<script type="text/javascript">
$(function(){
    $("#select_template").createSelect("${base}/templates/list", {}, function(row){
        return [row.id, row.cell[1]+"["+row.cell[0]+"]"];
    },  ${(item.template.id)!0}).change(function(){
    	var name = $("#input_name").val();
    	if(!name){
    		$("#input_name").val($(this).find("option:selected").text().replace(/(模板)?\[\d+\]/, "渲染器"));
    	}
    });
  $("#btadditem").bind("click", function(){
    $("#additemform").ajaxForm({
      dataType: "json",
      success: function(json){
        if(!json.success){
          art.dialog.through({
            title: "[#if (item.id)??]编辑${moduleName}信息[#else]添加新${moduleName}[/#if]失败",
            icon: "error",
            content: "[#if (item.id)??]编辑${moduleName}信息[#else]添加新${moduleName}[/#if]失败！<br>"+json.err,
            width: 250,
            height: 150,
            background: '#EEE', // 背景色
            opacity: 0.05,  // 透明度
            lock: true,
            ok: true
          });
        }else{
          try{
             art.dialog.open.origin.flexGridReload(".flexme3");
          }catch(e){
             try{
                 art.dialog.top.frames["_iframe"].window.flexGridReload(".flexme3");
             }catch(e){
                 art.dialog.top.window.flexGridReload(".flexme3");
             }
          }
          art.dialog.close();
        }
      }
    });
  });
});
</script>
</head>
<body>
<h3>[#if (item.id)??]编辑${moduleName}信息[#else]添加新${moduleName}[/#if]</h3>
<form id="additemform" action="${base}/${module}/${((item.id)??)?string('edit','add')}" method="POST">
<input type="hidden" name="id" value=${(item.id)!0}>
${moduleName}名:<input type="text" name="name" id="input_name" value="${(item.name)!}"/><br>
描述:<textarea rows="3" cols="35" name="description">${(item.description)!}</textarea><br>
路径:<input type="text" name="path" value="${(item.path)!r'src/${project.packageName}/'}" style="width: 300px"><br>
文件名:<input type="text" name="filename" value="${(item.filename)!r'${clazz.className}.java'}" style="width: 300px"><br>
渲染方式：<input type="radio" name="seperate" value="true" id="cb_seperate_true"${(item.seperate?string(' checked', ''))!' checked'}>
<label for="cb_seperate_true">单独渲染</label>
<input type="radio" name="seperate" value="false" id="cb_seperate_false"${(item.seperate?string('', ' checked'))!''}>
<label for="cb_seperate_false">收集渲染</label>
<br>
模板:
<select id="select_template" name="template.id">
<option value="0">--请选择模板--</option>
</select><br>

<input type="submit" value="保存新${moduleName}" id="btadditem">
</form>
</body>
</html>